package cn.jinzhu.stream;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
public class HelloController {
    @Autowired
    MyMsggChannel myMsggChannel;

    @GetMapping("/hello")
    public void hello(){
        System.out.println(new Date());
        //setHeader("x-delay",3000). 设置消息延迟三秒中 ，这个要配置rabbitmq的插件，在liunx里面下载
        myMsggChannel.output().send(MessageBuilder.withPayload("你好金柱").setHeader("x-delay",5000).build()); //自定义通道里面的生产者，发送一个消息

    }
}
